import rclpy
from rclpy.node import Node
from tf2_ros.buffer import Buffer
from tf2_ros.transform_listener import TransformListener

rclpy.init()
node = Node('transform_listener')
tf_buffer = Buffer()
tf_listener = TransformListener(tf_buffer,node)
def transform_callback():
    try:
        now = rclpy.time.Time()
        trans = tf_buffer.lookup_transform('C','O',now)
        print('trans',trans)
    except Exception as e:
        print(e,'---')
node.create_timer(1,transform_callback)
rclpy.spin(node)